<?php

/**
 * Composer of source db
 * To help declare source of Db name more efficient
 * @package ComposerSourceDb
 * @see Composer
 */
class ComposerSourceDb extends Composer{

  /**
   * index
   *
   * @var integer $index
   */
  private $index;

  /**
   * key of value
   *
   * @var array  $key
   */
  private $key = array();

  /**
   * value of key
   *
   * @var array  $value
   */
  private $value = array();

  /**
   * @var Database
   */
  private $Db;

  function __contruct(){

    $this->index = 0;
  }

  /**
   * add the identifier
   *
   * @param string  $key
   * @param string  $value
   */
  function add($key, $value){

    $index = &$this->index;

    $this->key[$index]    = $key;

    $this->value[$index]  = $value;

    $index++;
  }

  /**
   * fetch the key by value
   *
   * @param string  $value
   * @return string
   */
  function fetchKey($value){

    $index = array_search($value, $this->value);

    return $this->key[$index];
  }

  /**
   * fetch value by key
   *
   * @param string  $key
   * @return string
   */
  function fetchValue($key){

    $index = array_search($key, $this->key);

    return $this->value[$index];
  }

  /**
   * fetch the key by value
   *
   * @param string  $value
   * @return string
   */
  function getKey($value){

    $index = array_search($value, $this->value);

    return $this->key[$index];
  }

  /**
   * fetch value by key
   *
   * @param string  $key
   * @return string
   */
  function getValue($key){

    $index = array_search($key, $this->key);

    return $this->value[$index];
  }

  function del($key, $value){


  }


  function edit($key, $value){


  }
}

?>